<div class="potentials view">
    <h2><?php __('Potential'); ?></h2>
    <dl>
    <?php $i = 0;
$class = ' class="altrow"'; ?>
        <dt<?php if( $i % 2 == 0 ) echo $class; ?>><?php __('Name'); ?></dt>
        <dd<?php if( $i++ % 2 == 0 )
                echo $class; ?>>
                <?php echo $this->Html->link($potential['User']['firstname']." ".$potential['User']['lastname'], array('controller' => 'users', 'action' => 'view', $potential['User']['id'])); ?>
            &nbsp;
            <?php echo $this->Html->link('Add New Activity', array('controller' => 'potentialactivities','action' => 'add', 'forpotential' => $potential['Potential']['id']), array('class' => 'linkbutton', 'style' => 'float:right;')); ?>
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Email'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $potential['User']['email1']; ?>
            &nbsp;
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Phone Number'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $potential['User']['mobilephone']; ?>
            &nbsp;
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Product'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $this->Html->link($potential['Product']['name'], array('controller' => 'products', 'action' => 'view', $potential['Product']['id'])); ?>
            &nbsp;
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Type'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $potential['Potential']['type']; ?>
            &nbsp;
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Date Enquired'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $this->Time->timeAgoInWords($potential['Potential']['dateenquired']); ?>
            &nbsp;
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Description'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $potential['Potential']['description']; ?>
            &nbsp;
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Lead Stage'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $this->Html->link($potential['Leadstage']['name'], array('controller' => 'leadstages', 'action' => 'view', $potential['Leadstage']['id'])); ?>
            &nbsp;
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Deal Stage'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $this->Html->link($potential['Dealstage']['name'], array('controller' => 'dealstages', 'action' => 'view', $potential['Dealstage']['id'])); ?>
            &nbsp;
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Employee'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $this->Html->link($potential['Employee']['firstname'], array('controller' => 'employees', 'action' => 'view', $potential['Employee']['id'])); ?>
            &nbsp;
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Assigned To Employee'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $this->Html->link($potential['Assignedtoemployee']['firstname'], array('controller' => 'employees', 'action' => 'view', $potential['Assignedtoemployee']['id'])); ?>
            &nbsp;
        </dd>
        <dt<?php if( $i % 2 == 0 )
                        echo $class; ?>><?php __('Location'); ?></dt>
            <dd<?php if( $i++ % 2 == 0 )
                        echo $class; ?>>
                <?php echo $this->Html->link($potential['Location']['name'], array('controller' => 'locations', 'action' => 'view', $potential['Location']['id'])); ?>
            &nbsp;
        </dd>
    </dl>
</div>
<div class="related">
    <h3><?php __('Related Activities'); ?></h3>
    <?php if( !empty($potential['Activity']) ): ?>
        <table cellpadding = "0" cellspacing = "0">
            <tr>
                <th><?php __('Activity Type'); ?></th>
                <th><?php __('Subject'); ?></th>
                <th><?php __('Due Date'); ?></th>
                <th><?php __('Next Followup Date'); ?></th>
                <th><?php __('Employee Id'); ?></th>
                <th><?php __('Assigned To'); ?></th>
                <th><?php __('Done Date'); ?></th>
                <th><?php __('Final Status'); ?></th>
                <th class="actions"><?php __('Actions'); ?></th>
            </tr>
        <?php
                    $i = 0;
                    foreach($potential['Activity'] as $activity):
                        $class = null;
                        if( $i++ % 2 == 0 )
                        {
                            $class = ' class="altrow"';
                        }
        ?>
            <tr<?php echo $class; ?>>
                <td><?php echo $activity['Activitytype']['name']; ?></td>
                <td><?php echo $activity['subject']; ?></td>
                <td><?php echo $activity['duedate']; ?></td>
                <td><?php echo $activity['nextfollowupdate']; ?></td>
                <td><?php echo $activity['Employee']['firstname']; ?></td>
                <td><?php echo $activity['Assignedtoemployee']['firstname']; ?></td>
                <td><?php echo $activity['donedate']; ?></td>
                <td><?php echo $activity['finalstatus']; ?></td>
                <td class="actions">
                    <?php echo $this->Html->link(__('View', true), array('controller' => 'activities', 'action' => 'view', $activity['id'])); ?>
                    <?php echo $this->Html->link(__('Edit', true), array('controller' => 'activities', 'action' => 'edit', $activity['id'])); ?>
                    <?php echo $this->Html->link(__('Delete', true), array('controller' => 'activities', 'action' => 'delete', $activity['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $activity['id'])); ?>
                </td>
            </tr>
        <?php endforeach; ?>
        </table>
    <?php endif; ?>
</div>